package com.quasar.hpatient.module.doctor_search;

import android.support.v7.widget.RecyclerView;

import com.quasar.hpatient.R;
import com.quasar.hpatient.dialog.ChatDialog;

import lib.quasar.base.frame.BaseActivity;
import lib.quasar.widget.menu.DropDownMenu;

/**
 * description: 我的医生 ==> 添加医生
 * created by kalu on 2018/3/28 10:53
 */
public class DoctorSearchActivity extends BaseActivity<DoctorSearchPresenter> implements DoctorSearchView {

    @Override
    public int initView() {
        return R.layout.activity_doctor_search;
    }

    @Override
    public void initDataLocal() {

        findViewById(R.id.activity_doctor_search_back).setOnClickListener(v -> onBackPressed());

        final RecyclerView recycler = findViewById(R.id.activity_doctor_search_list);
        getPresenter().initList(this, recycler);

        final DropDownMenu menu = findViewById(R.id.activity_doctor_search_menu);
        getPresenter().initMenu(this, menu);
    }

    @Override
    public void initDataNet() {

        final RecyclerView recycler = findViewById(R.id.activity_doctor_search_list);
        getPresenter().doctorList(this, recycler);
    }

    @Override
    public void showChat(long doctorid) {

        final ChatDialog dialog = new ChatDialog(this);
        dialog.setOnDialogChangeListener(input -> {
            getPresenter().applyMessage(DoctorSearchActivity.this, doctorid);
        });
        dialog.show();
    }
}